import javax.swing.*;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

@SuppressWarnings("serial")
public class MazeGUI extends JFrame implements ActionListener
{
	MazePanel pane;
	
	public MazeGUI()
	{
		super("3D Maze Project");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(700,700);
        setLocationRelativeTo(null);
        
		JMenuBar menuBar = new JMenuBar();
		JMenu file = menuBar.add(new JMenu("File"));
		JMenuItem save = file.add(new JMenuItem("Save"));
		save.addActionListener(this);
		JMenuItem load = file.add(new JMenuItem("Load"));
		load.addActionListener(this);
		JMenuItem exit = file.add(new JMenuItem("Exit"));
		exit.addActionListener(this);
		
		Container content = this.getContentPane();
		content.setLayout(new BorderLayout());
		content.add(menuBar, BorderLayout.NORTH);
		//content.add(pane, BorderLayout.CENTER);
	}
	
	public static void main(String[] imAmeme)
	{
		//MazeGUI temp = new MazeGUI();
		//temp.setVisible(true);
		MazeGen.Maze temp = MazeGen.generateRandomMaze(7,9);
		for(int[] meh : temp.arr)
		{
			for(int i : meh)
			{
				if(i == 0)
					System.out.print("* ");
				else if(i == 1)
					System.out.print("  ");
				else if(i == 2)
					System.out.print("E ");
				else if(i == 3)
					System.out.print("S ");
			}
			System.out.println();
		}
	}
	
	public void save()
	{
		System.out.println("save is not implemented");
		//TODO Ask them to choose where to save
		//  Then mazePanel.save(File)?
	}
	
	public void load()
	{
		System.out.println("load is not implemented");
		//TODO Ask them to find what save they want to load
		//  Then mazePanel.load(File)?
	}
	
	public void exit()
	{
		System.out.println("exit is not implemented");
		//TODO Check to see if they really want to exit
		//  Then
		//    System.exit(0);
	}

	public void actionPerformed(ActionEvent e) 
	{
		if(e.getActionCommand().equals("Save"))
			save();
		else if(e.getActionCommand().equals("Load"))
			load();
		else if(e.getActionCommand().equals("Exit"))
			exit();
	}
}
